﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsLive;
using WindowsLive.Writer;
using WindowsLive.Writer.Api;

namespace TrailImage
{
	public class PluginBase : ContentSource
	{

		internal static string Selection { get; set; }

		public override void Initialize(IProperties options)
		{
			base.Initialize(options);
			Profile.Current = new Profile(base.Options);
		}

		/// <summary>
		/// Standard form load and processing
		/// </summary>
		protected DialogResult Process<F>(F form, Func<F, string> fn, IWin32Window win) where F : Form
		{
			var result = form.ShowDialog(win);
			if (result == DialogResult.OK) { PluginBase.Selection = fn(form); }
			return result;
		}
	}
}
